﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CanDoo.Data.Entity;
using CanDoo.Oil.Core.Models;

namespace CanDoo.Oil.Core.ModelConfigurations
{
    /// <summary>
    /// 实体类-数据表映射——盘点单明细
    /// </summary>
    public class InventoryDetailConfiguration : EntityConfigurationBase<InventoryDetail>
    {
        /// <summary>
        /// 初始化一个<see cref="InventoryDetailConfiguration"/>类型的新实例
        /// </summary>
        public InventoryDetailConfiguration()
        {
             ToTable("store_InventoryDetail");
             this.Property(p => p.InventoryId).HasColumnName("InventoryId");
             this.HasRequired(p => p.Inventory).WithMany(n=>n.InventoryDetails).HasForeignKey(p => p.InventoryId).WillCascadeOnDelete(false);

             this.Property(p => p.ProductId).HasColumnName("ProductId");
             this.HasRequired(p => p.Product).WithMany().HasForeignKey(p => p.ProductId).WillCascadeOnDelete(false);

        }
    }
}
